# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-dongshanpi-nezhastu
pkgdesc="DongshanPi NeZha STU"
pkgver=1
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="riscv64"
# pmb:strict: avoid grub-related install error during build with pmbootstrap
options="!check !archcheck pmb:strict"
depends="
	linux-postmarketos-allwinner-d1
	postmarketos-base
	u-boot-dongshanpi-nezhastu
"
makedepends="
	devicepkg-dev
	grub
	grub-efi
"
source="deviceinfo"

build() {
	devicepkg_build $startdir $pkgname

	grub-mkimage \
		--prefix="/grub" \
		--output="bootriscv64.efi" \
		--format="riscv64-efi" \
		--compression="xz" \
		\
		all_video \
		cat \
		configfile \
		disk \
		echo \
		efi_gop \
		fat \
		ext2 \
		gzio \
		help \
		iso9660 \
		linux \
		ls \
		normal \
		part_gpt \
		part_msdos \
		search \
		search_label \
		test \
		true
}

package() {
	devicepkg_package $startdir $pkgname
	install -Dm644 "$srcdir"/bootriscv64.efi \
		"$pkgdir"/boot/efi/boot/bootriscv64.efi
}

sha512sums="
340c7d568227d1fcba48abd22add3a68d148981d55ef10fcbd1ce860c3d9784d20930a1b20bb89b55761b5dba26fa1ad98453d3288cc58c63056b121bc7ad6d2  deviceinfo
"
